/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#ifndef _CUBEFS_API_METADATA_PAGE_HPP
#define _CUBEFS_API_METADATA_PAGE_HPP

#include <cubefs/api/metadata/group.hpp>

namespace cubefs    {
namespace api       {

static Int BTREE        = 1;
static Int ROOT         = 2;
static Int LEAF         = 4;
static Int BITMAP       = 8;

struct CUBEFS_API PageMetadata: public MetadataGroup {
    virtual Int Hash() 													= 0;
    virtual bool IsAbiCompatible() 										= 0;

    virtual void Externalize(const void *mem, void *buf) 				= 0;
    virtual void Internalize(const void *buf, void *mem, Int size) 		= 0;

    virtual Int GetDataBlockSize(const void* mem)						= 0;
    virtual Int GetPageDataBlockSize(Page* tpage)						= 0;
    virtual FieldMetadata* GetField(Int ptr, bool abi)					= 0;

    virtual Int GetPageSize() 											= 0;

    static Type* MyType();
};

CUBEFS_DECLARE_TYPENAME(PageMetadata,    "cubefs::api::metadata::PageMetadata");

}}

#endif
